package org.dlow.proxy.cglib;

import net.sf.cglib.proxy.Enhancer;
import org.dlow.annotation.RpcReference;
import org.dlow.common.constants.FaultTolerant;
import org.dlow.common.constants.LoadBalance;
import org.dlow.proxy.ServiceProxyProvider;

import java.util.concurrent.TimeUnit;

public class CgLibProxyProviderFactory implements ServiceProxyProvider {

    @Override
    public <T> T createProxy(Class<T> claz, RpcReference rpcReference)  {
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(claz);
        enhancer.setCallback(new CgLibProxy(claz,rpcReference));
        return (T) enhancer.create();
    }
}
